package main

import "fmt"

type user struct {
	name    string
	age     int
	class   string
	teacher teacher
}
type teacher struct {
	name string
}

func (u user) userinfo() string {
	return fmt.Sprintf("%s,%d,%s,%s", u.name, u.age, u.class, u.teacher.name)
}

func test() {
	fmt.Println("多结构体，组合的使用")
	t := teacher{
		name: "Mr.li",
	}
	u := user{
		name:    "dong",
		age:     10,
		class:   "1",
		teacher: t,
	}
	fmt.Println(u.userinfo())
}

func test1() {

}

func main() {
	test()
	test1()
}
